<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function login(){
				var _uname=uname.value;
				var _upwd=upwd.value;
				if(!_uname){
					alert("用户名不能为空")
				}
				if(!_upwd){
					alert("密码不能为空")
				}
				var xhr=new XMLHttpRequest();
				xhr.onreadystatechange=function(){
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						//console.log(r)
						if(r==1){
							alert("登陆成功");
							location.href="2_list.html"
						}else{
							alert("登陆失败")
							
						}
					}
				}
				xhr.open("get",`/ajax/v1/login/${_uname}&${_upwd}`,true)
				xhr.send();
			}
		</script>
	</head>
	<body>
		<input type="text" id="uname" placeholder="请输入用户名"><br>
		<input type="text" id="upwd" placeholder="请输入密码"><br>
		<button onclick="login()">登录</button>
	</body>
</html>
